package com.grts.service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;




import com.grts.dao.TeacherMapper;
import com.grts.pojo.Teacher;
import com.grts.service.Teacherservice;
import com.grts.utils.PageModel;
@Service
public class TeacherserviceImpl implements Teacherservice {
	@Resource
	private TeacherMapper dao;
	PageModel pageModel = new PageModel();
	@Override
	public Teacher selectByPrimaryKey(Integer tid) {
		// TODO Auto-generated method stub
		return dao.selectByPrimaryKey(tid);
	}
	@Override
	public List<Teacher> queryall(Teacher record) {
		// TODO Auto-generated method stub
		return dao.queryall(record);
	}
	@Override
	public int deleteByPrimaryKey(Integer tid) {
		// TODO Auto-generated method stub
		return dao.deleteByPrimaryKey(tid);
	}
	@Override
	public int insert(Teacher record) {
		// TODO Auto-generated method stub
		return dao.insert(record);
	}
	@Override
	public int insertSelective(Teacher record) {
		// TODO Auto-generated method stub
		return dao.insertSelective(record);
	}
	@Override
	public int updateByPrimaryKeySelective(Teacher record) {
		// TODO Auto-generated method stub
		return dao.updateByPrimaryKeySelective(record);
	}
	@Override
	public int updateByPrimaryKey(Teacher record) {
		// TODO Auto-generated method stub
		return dao.updateByPrimaryKey(record);
	}
	@Override
	public PageModel queryPageModel(Teacher t,int currentPage,int pageSize){
		List result=dao.queryall(t);
		List result1=dao.queryByPage(t);
		pageModel.setCurrentPage(currentPage);
		pageModel.setPageSize(pageSize);
		pageModel.setPageCount((currentPage-1)/pageSize);
		pageModel.setTotalCount(result.size());
		pageModel.setResult(result1);
		return pageModel;
		
	}
}
